<template>
  <el-dialog title="提示" :visible="value">
    <el-upload
      class="upload-demo"
      drag
      :show-file-list="false"
      action=""
      :http-request="fileChangeTmp"
    >
      <i class="el-icon-upload" />
      <div class="el-upload__text">将文件拖到此处，或<em>点击上传</em></div>
      <div slot="tip" class="el-upload__tip">
        只能上传jpg/png文件，且不超过500kb
      </div>
    </el-upload>
    <span slot="footer" class="dialog-footer">
      <el-button>取 消</el-button>
    </span>
  </el-dialog>
</template>

<script>
import { userImportRequest } from '@/api/employee'
export default {
  name: 'ImportExcelTwo',
  props: {
    value: {
      type: Boolean,
      default: false
    }
  },
  data() {
    return {}
  },
  methods: {
    async fileChangeTmp(e) {
      const file = e.file
      const formData = new FormData()
      formData.append('file', file)

      await userImportRequest(formData)
    }
  }
}
</script>
